package com.michaelbulava.TFS.vcs.internal.conflicts;

import com.intellij.util.WaitForProgressToShow;
import com.michaelbulava.TFS.ui.dialogs.conflicts.ResolveConflictsDialog;
import com.michaelbulava.TFS.vcs.exceptions.TFSException;

/**
 * Created by MichaelA on 8/17/2015.
 */
public class DialogConflictsHandler implements ConflictsHandler {

    @Override
    public void resolveConflicts(final ResolveConflictHelper resolveConflictHelper) throws TFSException {
        if(resolveConflictHelper.getConflicts().isEmpty())
            return;
        WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(new Runnable() {
            @Override
            public void run() {
                ResolveConflictsDialog d = new ResolveConflictsDialog(resolveConflictHelper);
                d.showAndGet();
            }
        });
    }
}
